/*
 * Copyright (C) 2011 ~ 2018 Deepin Technology Co., Ltd.
 *
 * Author:     fanpengcheng <fanpengcheng_cm@deepin.com>
 *
 * Maintainer: fanpengcheng <fanpengcheng_cm@deepin.com>
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
#include "mainwindow.h"

#include <DPlatformWindowHandle>
#include <DPushButton>
#include <DApplication>
#include <DApplicationSettings>
#include <DLog>

#include <QLineEdit>
#include <QDebug>
#include <QDateTime>

DCORE_USE_NAMESPACE
DWIDGET_USE_NAMESPACE

int main(int argc, char *argv[])
{
    DApplication::loadDXcbPlugin();
    DApplication a(argc, argv);

    a.loadTranslator();
    a.setAttribute(Qt::AA_EnableHighDpiScaling, true);

    if (!a.setSingleInstance("deepin-tool-kit-examples")) {
        qDebug() << "another instance is running!!";
    }

    a.setApplicationName("dtk-example");
    a.setOrganizationName("deepin");
    DApplicationSettings as;
    Q_UNUSED(as)

    //    DLogManager::registerConsoleAppender();
    //    DLogManager::registerFileAppender();

    MainWindow w;
    w.show();

    uint time_t = QDateTime::currentDateTime().toTime_t();
    qInfo() << "原始时间" << QDateTime::currentDateTime().toString("yyyy/MM/dd hh:mm:ss");

    QDateTime dt = QDateTime::fromTime_t(time_t);
    qInfo() << "由时间戳转换成的时间" << dt.toString("yyyy/MM/dd hh:mm:ss");

    return a.exec();
}
